﻿using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using CoreLibrary.Paging;
using CoreLibrary.Service;
using Entities.DataBase.Obj;
using WebService.Service.Transfer;

namespace WebService.Service {

    [ServiceContract]
    public interface IProductServiceX {

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/AddProduct")]
        bool AddProduct(string passport, AddProductRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/DeleteProduct")]
        bool DeleteProduct(string passport, string productId);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/UpdateProduct")]
        bool UpdateProduct(string passport, string productId, UpdateProductRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/ListProducts")]
        PagingResult<ProductInfo> ListProducts(string passport, int catalogId, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/ListProductsByKeyword")]
        PagingResult<ProductInfo> ListProductsByKeyword(string passport, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/SearchProducts")]
        PagingResult<ProductInfo> SearchProducts(string passport, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/CreatePurchaseRecord")]
        string CreatePurchaseRecord(string passport, CreatePurchaseRecordRequest request);
        
        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/UpdatePurchaseRecord")]
        bool UpdatePurchaseRecord(string passport,  UpdatePurchaseRecordRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/TransferPurchaseRecord")]
        string TransferPurchaseRecord(string passport, TransferPurchaseRecordRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/DeletePurchaseRecord")]
        bool DeletePurchaseRecord(string passport, string recordId);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/ListPurchaseRecords")]
        PagingResult<PurchaseRecordInfo> ListPurchaseRecords(string passport, string productId, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/SearchPurchaseRecords")]
        PagingResult<PurchaseRecordInfo> SearchPurchaseRecords(string passport, SearchPurchaseRecordRequest request);

        
        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/SearchStocks")]
        PagingResult<StockInfo> SearchStocks(string passport, SearchStockRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/SyncStock")]
        bool SyncStock(string passport, string productId, int location);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/ListStocks")]
        PagingResult<StockInfo> ListStocks(string passport, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json,
                   UriTemplate = "/ListStocksByLocation")]
        PagingResult<StockInfo> ListStocksByLocation(string passport, int location, PagingRequest request);

       
    }
}
